import { request } from '@/utils/request.js'

export default {
  /**
   * 分頁獲取用戶分組列表
   * @param {object} data
   * @param {string} data.page
   * @param {string} data.page_size
   * @returns
   */
  getUserGroupList(params = {}) {
    return request({
      url: '/api/v1/admin/user/group/list',
      method: 'get',
      params
    })
  },
  /**
   * 創建用戶分組
   * @param {object} data
   * @param {string} data.name
   * @param {string} data.description
   * @returns
   */
  createUserGroup(data = {}) {
    return request({
      url: '/api/v1/admin/user/group/create',
      method: 'post',
      data
    })
  },
  updateUserGroup(id, data = {}) {
    return request({
      url: '/api/v1/admin/user/group/' + id + '/update',
      method: 'post',
      data
    })
  },
  deleteUserGroup(id) {
    return request({
      url: '/api/v1/admin/user/group/' + id + '/delete',
      method: 'post'
    })
  },
  getUserGroup(id) {
    return request({
      url: '/api/v1/admin/user/group/' + id,
      method: 'get'
    })
  },
  addUserToGroup(id, data = {}) {
    return request({
      url: '/api/v1/admin/user/group/' + id + '/member/add',
      method: 'post',
      data
    })
  },
  removeUserToGroup(id, data = {}) {
    return request({
      url: '/api/v1/admin/user/group/' + id + '/member/remove',
      method: 'post',
      data
    })
  },
  // /api/v1/admin/user/info/list
  getUserInfoList(params = {}) {
    return request({
      url: '/api/v1/admin/user/info/list',
      method: 'get',
      params
    })
  }
}
